<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Fake</title>
    <link type="text/css" href="css/css.css" rel="stylesheet"/>
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/js.js"></script>
    <script src="js/layer/layer.js"></script>
    <script src="js/wb.js" type="text/javascript" charset="utf-8"></script>


    <script type="text/javascript">
        $(function () {
            $(".vipNav dd:eq(1)").show();
        })
    </script>
</head>

<body style="background-color: white">
<div class="mianCont">
    <div class="top">
        <span id="xianshiquyu">欢迎来到Fake 请&nbsp;<a href="login-register.html">[登录/注册]</a></span>
        <span class="topRight">
    <a href="vip.html">Fake</a>&nbsp;|
    <a href="order.html">我的订单</a>&nbsp;|
    <a href="vip.html">会员中心</a>&nbsp;|
    <a href="contact.html">联系我们</a>
   </span>
    </div><!--top/-->
    <div class="lsg">
        <h1 class="logo"><a href="index.html"><img src="images/logoA.png" width="280" height="81" /></a></h1>
        <form action="#" method="get" class="subBox">
            <div class="subBoxDiv">
                <input type="text" class="subLeft"/>
                <input type="image" src="images/subimg.png" width="63" height="34" class="sub"/>
                <div class="hotWord">
                    热门搜索：
                    <a href="proinfo.html">冷饮杯</a>&nbsp;
                    <a href="proinfo.html">热饮杯</a> &nbsp;
                    <a href="proinfo.html">纸杯</a>&nbsp;
                    <a href="proinfo.html">纸巾</a> &nbsp;
                    <a href="proinfo.html">纸巾</a> &nbsp;
                    <a href="proinfo.html">纸杯</a>&nbsp;
                </div><!--hotWord/-->
            </div><!--subBoxDiv/-->
        </form><!--subBox/-->
        <div class="gouwuche">
            <div class="gouCar">
                <img src="images/gouimg.png" width="19" height="20" style="position:relative;top:6px;"/>&nbsp;|&nbsp;
                <strong class="red">0</strong>&nbsp;件&nbsp;|
                <strong class="red">￥ 0.00</strong>
                <a href="order.html">去结算</a> <img src="images/youjian.jpg" width="5" height="8"/>
            </div><!--gouCar/-->
            <div class="myChunlv">
                <a href="vip.html"><img src="images/mychunlv.jpg" width="112" height="34"/></a>
            </div><!--myChunlv/-->
        </div><!--gouwuche/-->
    </div><!--lsg/-->
    <div class="pnt">
        <div class="pntLeft">
            <h2 class="Title">所有商品分类
                <ul class="InPorNav">
                    <li><a href="product.html">纸杯系列</a>
                        <div class="chilInPorNav">
                            <a href="#">单层热饮杯</a>
                            <a href="#">双层中空杯</a>
                            <a href="#">瓦楞隔热杯</a>
                            <a href="#">双淋膜冷饮杯</a>
                            <a href="#">爆米花桶</a>
                            <a href="#">纸碗</a>
                            <a href="#">冰淇淋纸杯</a>
                            <a href="#">PS杯盖</a>
                        </div><!--chilLeftNav/-->
                    </li>
                    <li><a href="product.html">PET系列</a>
                        <div class="chilInPorNav">
                            <a href="#">PET透明杯</a>
                            <a href="#">PET透明盖</a>
                            <a href="#">PET透明沙拉盒</a>
                        </div><!--chilLeftNav/-->
                    </li>
                    <li><a href="product.html">饮品杯配套系列</a>
                        <div class="chilInPorNav">
                            <a href="#">杯袖</a>
                            <a href="#">环保纸浆杯托</a>
                            <a href="#">纸杯打包袋</a>
                            <a href="#">吸管</a>
                            <a href="#">搅拌棒</a>
                            <a href="#">杯盖</a>
                        </div><!--chilLeftNav/-->
                    </li>
                    <li><a href="product.html">纸浆环保餐具系列</a>
                        <div class="chilInPorNav">
                            <a href="#">纸碟</a>
                            <a href="#">纸碗</a>
                            <a href="#">纸浆带盖汤碗</a>
                            <a href="#">连体餐盒</a>
                            <a href="#">分体餐盒</a>
                            <a href="#">纸浆沙拉盒</a>
                            <a href="#">纸托盘</a>
                        </div><!--chilLeftNav/-->
                    </li>
                    <li><a href="product.html">纸餐盒系列</a>
                        <div class="chilInPorNav">
                            <a href="#">圆底纸餐盒</a>
                            <a href="#">方底纸餐盒</a>
                            <a href="#">三明治纸盒</a>
                            <a href="#">蛋糕盒</a>
                            <a href="#">其他纸餐盒</a>
                        </div><!--chilLeftNav/-->
                    </li>
                    <li><a href="product.html">刀叉勺餐具</a>
                        <div class="chilInPorNav">
                            <a href="#">PS刀叉勺系列</a>
                            <a href="#">PLA刀叉勺系列</a>
                            <a href="#">淀粉刀叉勺系列</a>
                            <a href="#">搅拌棒/吸管</a>
                        </div><!--chilLeftNav/-->
                    </li>
                    <li><a href="product.html">生活用纸</a>
                        <div class="chilInPorNav">
                            <a href="#">餐巾纸</a>
                            <a href="#">抽纸</a>
                            <a href="#">卫生纸</a>
                            <a href="#">擦手纸</a>
                            <a href="#">其他纸类</a>
                        </div><!--chilLeftNav/-->
                    </li>
                    <li><a href="product.html">纸袋/环保打包袋</a>
                        <div class="chilInPorNav">
                            <a href="#">纸袋</a>
                            <a href="#">环保淀粉塑料袋</a>
                            <a href="#">PLA塑料袋</a>
                            <a href="#">食品袋</a>
                        </div><!--chilLeftNav/-->
                    </li>
                </ul><!--InPorNav/-->
            </h2>
        </div><!--pntLeft/-->
        <div class="pntRight">
            <ul class="nav">
                <li><a href="index.html">商城首页</a></li>
                <li><a href="product.html">促销中心</a></li>
                <li><a href="vip.html">会员中心</a></li>
                <li><a href="help.html">帮助中心</a></li>
                <div class="clears"></div>
                <div class="phone">TEL：021-12345678</div>
            </ul><!--nav/-->
        </div><!--pntRight/-->
        <div class="clears"></div>
    </div><!--pnt/-->
    <div class="positions">
        当前位置：<a href="index.html">首页</a> &gt; <a href="vip.html">会员中心</a>
        &gt; <a href="#" class="posCur">我的订单</a>
    </div><!--positions/-->
    <div class="cont">
        <div class="contLeft" id="contLeft">
            <h3 class="leftTitle">会员中心</h3>
            <dl class="helpNav vipNav">
                <dt>我的主页</dt>
                <dd>
                    <a href="vip.html">个人中心</a>
                    <a href="vipOrder.html">我的订单</a>
                </dd>
                <dt>账户设置</dt>
                <dd>
                    <a href="vipMy.html">个人信息</a>
                    <a href="vipPwd.html">密码修改</a>
                    <div>
                        <a href="vipAdress.html" class="vipCur">收货地址</a>

                    </div>
                </dd>
                <dt>客户服务</dt>
                <dd>
                    <a href="vipExit.html">网站使用条款</a>
                    <a href="vipTuihuo.html">网站免责声明</a>
                    <a href="message.html">在线留言</a>
                </dd>
            </dl><!--helpNav/-->
        </div><!--contLeft/-->


        <div class="contRight">
            <h2 class="oredrName">
                收货地址
            </h2>
            <div class="address"  id="disp" >
                <div class="addList">
                    <label><span class="red">* </span>选择地区:</label>
                    <input placeholder="请输入省份、市、地区、" type="text" id="address_city"/>
                </div><!--addList-->

                <div class="addList">
                    <label><span class="red">* </span>详细地址:</label>
                    <input placeholder="请输入街道、小区、门牌号" type="text" id="address_address"/>
                </div><!--addList-->

                <div class="addList">
                    <label><span class="red">* </span>备注:</label>
                    <input type="text" id="address_remark"/>
                </div><!--addList-->

                <div class="addList">
                    <label><span class="red">* </span>收件人:</label>
                    <input type="text" id="address_name"/>
                </div><!--addList-->

                <div class="addList">
                    <label><span class="red">* </span>手机号码:</label>
                    <input type="text" id="address_phone"/>
                </div><!--addList-->


                <div class="addList2">
                    <input type="image" id="address_add" src="images/queren.jpg" width="100" height="32"/>
                </div><!--addList2/-->
            </div><!--address/-->


            <table class="vipAdress">

                <thead>
                <tr>
                    <th>收货地址编号</th>
                    <th>收货人</th>
                    <th>所在地区</th>
                    <th>街道地址</th>
                    <th>电话/手机</th>
                    <th>操作</th>
                </tr>
                </thead>

                <tbody>


                </tbody>
            </table><!--vipAdress/-->
        </div>
        <!--contRight/-->
        <div class="clears"></div>
    </div><!--cont/-->
    <div class="inHelp">
        <div class="inHLeft">
            <h4>帮助中心</h4>
            <ul class="inHeList">
                <li><a href="help.html">购物指南</a></li>
                <li><a href="help.html">支付方式</a></li>
                <li><a href="help.html">售后服务</a></li>
                <li><a href="about.html">企业简介</a></li>
                <div class="clears"></div>
            </ul><!--inHeList/-->
        </div><!--inHLeft/-->
        <div class="inHLeft">
            <h4>会员服务</h4>
            <ul class="inHeList">
                <li><a href="reg.html">会员注册</a></li>
                <li><a href="login.html">会员登录</a></li>
                <li><a href="order.html">购物车</a></li>
                <li><a href="order.html">我的订单</a></li>
                <div class="clears"></div>
            </ul><!--inHeList/-->
        </div><!--inHLeft/-->
        <div class="inHRight">
            <h4>全国统一免费服务热线</h4>
            <div class="telBox">400-0000-0000</div>
            <div class="weibo">
                <wb:follow-button uid="2991975565" type="red_1" width="67" height="24"></wb:follow-button>
            </div>
        </div><!--inHRight/-->
        <div class="clears"></div>
    </div><!--inHelp/-->
    <div class="footer">
        <p>
            <a href="#">进入17官网</a>&nbsp;|&nbsp;
            <a href="index.html">商城首页</a>&nbsp;|&nbsp;
            <a href="product.html">促销中心</a>&nbsp;|&nbsp;
            <a href="order.html">我的订单</a>&nbsp;|&nbsp;
            <a href="new.html">新闻动态</a>&nbsp;|&nbsp;
            <a href="login.html">会员中心</a>&nbsp;|&nbsp;
            <a href="help.htmll">帮助中心</a>
        </p>
        <p>
            版权所有：上海17实业有限公司 版权所有 Copyright 2010-2015 沪ICP备00000000号 <a href="http://www.mycodes.net/" target="_blank">源码之家</a>
        </p>
    </div><!--footer/-->
</div><!--mianCont/-->
<a href="#" class="backTop">&nbsp;</a>

<script>
    //访问页面直接触发
    $(function () {
        seletAddress();

    })

    //点击

    $(function () {
        $('#vipAdd').click(function () {
            seletAddress();

        })
    })
    //点击  编辑  触发的事件
    function editType(id) {
        $('#disp').attr("style","display:block");
        $('#address_add').click(function () {
            $.ajax({
                url: 'update_address',
                data: {
                    "addno":id,
                    "city": $('#address_city').val(),
                    "address": $('#address_address').val(),
                    "remark": $('#address_remark').val(),
                    "name": $('#address_name').val(),
                    "addphone": $('#address_phone').val(),
                },
                dataType: 'json',
                type: 'post',
                success: function (data) {
                    if (data.code == 200) {
                        layer.msg(data.msg, {icon: 1, time: 2000}, function () {
                            location.href = "vipAdress.html";
                        })
                    }
                },
                error: function () {

                }
            })
        })

    }
    //点击    添加  触发的事件
    function addType() {
        $('#disp').attr("style","display:block");
        $('#address_add').click(function () {
            $.ajax({
                url: 'add_address',
                data: {
                    "city": $('#address_city').val(),
                    "address": $('#address_address').val(),
                    "remark": $('#address_remark').val(),
                    "name": $('#address_name').val(),
                    "addphone": $('#address_phone').val(),
                },
                dataType: 'json',
                type: 'post',
                success: function (data) {
                    if (data.code == 200) {
                        layer.msg(data.msg, {icon: 1, time: 2000}, function () {
                            location.href = "vipAdress.html";
                        })
                    }
                },
                error: function () {

                }
            })
        })

    }
    //查询的函数
    function seletAddress() {
        $('tbody').empty();
        $.ajax({
            url: 'select_address',
            data: {},
            dataType: 'json',
            type: 'post',
            success: function (data) {
                console.log(data)
                if (data.code == 200) {
                    $.each(data.result, function (index, obj) {
                        var tr = $('<tr></tr>');
                        var td1 = $('<td></td>').text(obj.addno);
                        var td2 = $('<td></td>').text(obj.aname);
                        var td3 = $('<td></td>').text(obj.city);
                        var td4 = $('<td></td>').text(obj.address);
                        var td5 = $('<td></td>').text(obj.addphone);
                        var td6 = $('<td></td>').html('<button type="button" onclick="editType(' + obj.addno + ')" class="btn btn-primary">编辑</button>&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" onclick="addType()" class="btn btn-primary">添加</button>&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" onclick="delType(' + obj.addno + ')" class="btn btn-danger">删除</button>')

                        tr.append(td1).append(td2).append(td3).append(td4).append(td5).append(td6);
                        $('tbody').append(tr);

                    })
                } else {


                }
            }

        })

    }


    //点击    删除  触发的函数
    function delType(id) {
        layer.confirm('是否确认删除该商品类型', {icon: 3, title: '删除提示'}, function (index) {
            $.getJSON('del_address', {addno: id}, function (data) {
                if (data.code == 200) {
                    layer.msg(data.msg, {icon: 1, time: 2000}, function () {
                        seletAddress();
                    })
                }
            })
            layer.close(index);
        });

    }

</script>

</body>


</html>